package com.qf.postProcessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @version v1.0.0
 * @Description:
 * @author: 姜红凯
 * @date: 2022.02.09
 * @since 1.0
 */
public class MyBeanPostProcessor implements BeanPostProcessor {
    /**
     * 创建对象之前执行
     * @param bean
     * @param beanName
     * @return
     * @throws BeansException
     */
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("后处理器：创建对象前执行");
        return bean;
    }

    /**
     * 创建对象之后执行
     * @param bean
     * @param beanName
     * @return
     * @throws BeansException
     */
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("后处理器：创建对象后执行");
        return bean;
    }
}
